#include <wx/wx.h>
#include <wx/textfile.h>
#include <string>

using namespace std;

int main(){
	wxTextFile file;
	wxString filePath = "TTP.txt";
	file.Create(filePath);

	// 查找是否存在文件
	if(!wxFileExists(filePath)){
		cout<<"The File do Not exists."<<endl;
		return -1;
	}
	else
		cout<<"Well Done, the file exist."<<endl;

	// 打开文件
	if(!file.Open(filePath)){
		cout<<"Fail to open the file."<<endl;
		return -1;
	}
	else
		cout<<"Well Done, the file is Opened."<<endl;

	// 插入行
	wxString strLine = "This is a Test.";
	file.AddLine(strLine);

	file.Write();
	file.Close();
}